<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>叩丁狼骡窝窝后台管理系统</title>
    <#include "../common/header.ftl" >
    <script type="text/javascript" src="/js/My97DatePicker/WdatePicker.js"></script>
    <script>
        $(function () {
            $(".lookBtn").click(function () {
                //模态框展示前,先填充信息
                var content = $(this).data("content");
                $(".modal-body p").html(content);
                $("#contentModal").modal("show");
            });
            
            $(".btn-input").click(function () {
                $("#inputModal").modal("show");
            });


            $(".btn-submit").click(function () {
                $("#editForm").ajaxSubmit(function (data) {
                    if (data.success){
                        window.location.reload();
                    }
                })
            })
        })
    </script>

</head>
<body>

<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-3">
            <#assign currentMenu="message"/>
            <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">系统信息管理</h1>
                </div>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/information/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <div class="form-group">
                    <label>关键字</label>
                    <input class="form-control" type="text" name="keyword" value="${(qo.keyword)!}" placeholder="请输入关键字!">
                </div>
                <div class="form-group">
                    <button id="query" type="submit" class="btn btn-success"><i class="icon-search"></i> 查询</button>
                </div>
                <a href="javascript:;" class="btn btn-success btn-input">添加</a>
            </form>

            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>消息内容</th>
                    <th>发布时间</th>
                    <th>消息类型</th>
                    <th>发布人员</th>
                    <th>操作</th>
                </tr>

                </thead>
                <#list pageInfo.list as entity>
                <tr>
                    <td>${entity_index + 1}</td>
                    <td>${entity.title}</td>
                    <td>${entity.createTime?date}</td>
                    <td>${entity.typeName}</td>
                    <td>${(entity.user.nickName)!}</td>
                    <td>
                        <a class="btn btn-info btn-xs lookBtn" data-content="${entity.content}">
                            <span class="glyphicon glyphicon-comment"></span> 查看消息
                        </a>
                    </td>
                </tr>
                </#list>
            </table>
            <#include "../common/page.ftl" />
        </div>
    </div>
</div>
<#--查看消息内容模态框-->
<div class="modal fade" id="contentModal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">消息内容</h4>
            </div>
            <div class="modal-body">
                <p>

                </p>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<#--编辑消息模态框-->
<div class="modal fade" id="inputModal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">新增系统消息</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/information/save.do" method="post" id="editForm"
                      enctype="multipart/form-data">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">标题：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="title">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-4 control-label">消息类别：</label>
                        <div class="col-sm-6">
                            <select id="catalogSelect" class="form-control" autocomplete="off" name="type" disabled>
                                <option value="0" selected>系统消息</option>
                                <option value="1">群组消息</option>
                                <option value="2">用户消息</option>
                            </select>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-4 control-label">消息内容：</label>
                        <div class="col-sm-6">
                            <textarea class="form-control" rows="3" name="content"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary btn-submit">保存</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</body>
</html>